home *** CD-ROM | disk | FTP | other *** search
- Path: cypher.3do.com!user
- From: tsw@3do.com (Tom Watson)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
- Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
- Date: Wed, 10 Apr 1996 18:37:31 -0800
- Organization: The 3DO Corporation
- Distribution: world
- Message-ID: <tsw-1004961837310001@cypher.3do.com>
- References: <JSA.96Feb16135027@organon.com> <4kb2j8$an0@solutions.solon.com> <4kbrt5$k3h@mulga.cs.mu.OZ.AU> <dewar.829012486@schonberg> <4kcpgkINNcku@keats.ugrad.cs.ubc.ca> <TYNOR.96Apr9105114@twratl.atlanta.twr.com> <4kgunm$o4o@gde.GDEsystems.COM>
- NNTP-Posting-Host: cypher.3do.com
-
- In article <4kgunm$o4o@gde.GDEsystems.COM>, Chet <kackman> wrote:
-
- > If i = j depends on your unit of address. If i is assumed a longword then
- >
- > &i + 4 = &j is true
- > not
- > &i + 1 = &j
- >
- > Chet
-
- Bzzzzzt. Sorry wrong answer, and thank you for playing the game.
-
- Adding '1' to a pointer implies that you increment the address by the
- sizeof the object pointed to.
-
- Why else is a[i] =(equivalent to)= *(a+i).
-
- Now in the original example (deleted before this response) the second
- object 'j' in this case could be optimized into a register, if its address
- weren't taken somewhere.
-
- All of this can explain why one can't do arithmetic on a 'void *' unless
- the compiler has made special (non-ANSI) arrangements. Typically
- sizeof(void) is defined in the compiler as zero so this can't be done (and
- it produces an error!).
-
- --
- Tom Watson
- tsw@3do.com (Home: tsw@johana.com)
-